package com.github.cyf.controller;

import com.github.cyf.common.model.Rs;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author chenyifan
 * @create 2024-11-14 9:46
 */
@RestController
@RequestMapping("/file")
@Api(tags = "1、文件上传漏洞测试")
@ApiSupport(order = 1)
public class FileController {

    /**
     * 修改文件后缀躲过检测
     * @param file
     * @return
     */
    @ApiOperation("文件上传")
    @ApiOperationSupport(order = 1)
    @PostMapping("/upload")
    public Rs show(@RequestPart("file") MultipartFile file) {
        return Rs.ok().set("size", file.getSize()).set("fileName", file.getOriginalFilename());
    }
}